﻿using System.Collections.Generic;

namespace System.Web.Mvc.Html
{
    public class IndexView
    {
        public IndexView(IEnumerable<dynamic> items, int index = 0, int size = 20, int count = 0, string order = null, bool desc = false, string query = null)
        {
            this.items = new List<dynamic>(items);
            this.desc = desc;
            this.order = order;
            this.query = query;
            this.page = new Pager(index, size, count);
        }
        internal List<dynamic> items;
        public Pager page;
        public class Pager
        {
            public Pager(int index, int size, int count)
            {
                this.index = index;
                this.size = size;
                this.count = count;
                this.page = (count - 1) / size + 1;
            }
            public int index;
            public int size;
            public int count;
            public int page;
        }
        public string query;
        public bool desc;
        public string order;

    }

}